package com.note.simpleshop.entity;

import com.note.simpleshop.utils.IdGenerator;

import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "tb_order", schema = "simpleshop", catalog = "")
public class TbOrder {
    public static final Integer ORDER_STATUS0=0;//待付款
    public static final Integer ORDER_STATUS1=1;//待发货,已付款
    public static final Integer ORDER_STATUS2=2;//已发货
    public static final Integer ORDER_STATUS3=3;//交易成功
    public static final Integer ORDER_STATUS4=4;//待评价
    private String id;
    private String receiver;
    private String address;
    private String phone;
    private String logisticsNo;
    private BigDecimal orderAmount;
    private BigDecimal payAmount;
    private String orderNo;
    private Integer orderStatus;
    private Date orderTime;
    private Date payTime;
    private String payType;
    private String prepareId;
    private String userId;
    private String logisticsCode;
    private Date expireTime;
    private String nickName;
    private Integer isDelete;


    public TbOrder() {

    }

    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "receiver")
    public String getReceiver() {
        return receiver;
    }

    public void setReceiver(String receiver) {
        this.receiver = receiver;
    }

    @Basic
    @Column(name = "address")
    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Basic
    @Column(name = "phone")
    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Basic
    @Column(name = "logistics_no")
    public String getLogisticsNo() {
        return logisticsNo;
    }

    public void setLogisticsNo(String logisticsNo) {
        this.logisticsNo = logisticsNo;
    }

    @Basic
    @Column(name = "order_amount")
    public BigDecimal getOrderAmount() {
        return orderAmount;
    }

    public void setOrderAmount(BigDecimal orderAmount) {
        this.orderAmount = orderAmount;
    }
    @Basic
    @Column(name = "pay_amount")
    public BigDecimal getPayAmount() {
        return payAmount;
    }

    public void setPayAmount(BigDecimal payAmount) {
        this.payAmount = payAmount;
    }

    @Basic
    @Column(name = "order_no")
    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    @Basic
    @Column(name = "order_status")
    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    @Basic
    @Column(name = "order_time")
    public Date getOrderTime() {
        return orderTime;
    }

    public void setOrderTime(Date orderTime) {
        this.orderTime = orderTime;
    }

    @Basic
    @Column(name = "pay_time")
    public Date getPayTime() {
        return payTime;
    }

    public void setPayTime(Date payTime) {
        this.payTime = payTime;
    }

    @Basic
    @Column(name = "pay_type")
    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    @Basic
    @Column(name = "prepare_id")
    public String getPrepareId() {
        return prepareId;
    }

    public void setPrepareId(String prepareId) {
        this.prepareId = prepareId;
    }

    @Basic
    @Column(name = "user_id")
    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }
    @Basic
    @Column(name = "nick_name")
    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }
    @Basic
    @Column(name = "is_delete")
    public Integer getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TbOrder tbOrder = (TbOrder) o;
        return Objects.equals(id, tbOrder.id) &&
                Objects.equals(receiver, tbOrder.receiver) &&
                Objects.equals(address, tbOrder.address) &&
                Objects.equals(phone, tbOrder.phone) &&
                Objects.equals(logisticsNo, tbOrder.logisticsNo) &&
                Objects.equals(orderAmount, tbOrder.orderAmount) &&
                Objects.equals(orderNo, tbOrder.orderNo) &&
                Objects.equals(orderStatus, tbOrder.orderStatus) &&
                Objects.equals(orderTime, tbOrder.orderTime) &&
                Objects.equals(payTime, tbOrder.payTime) &&
                Objects.equals(payType, tbOrder.payType) &&
                Objects.equals(prepareId, tbOrder.prepareId) &&
                Objects.equals(userId, tbOrder.userId)&&
                Objects.equals(expireTime, tbOrder.expireTime)&&
                Objects.equals(nickName, tbOrder.nickName)&&
                Objects.equals(payAmount, tbOrder.payAmount)&&
                Objects.equals(isDelete, tbOrder.isDelete);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, receiver, address, phone, logisticsNo, orderAmount, orderNo, orderStatus, orderTime, payTime, payType, prepareId, userId,nickName,payAmount,isDelete);
    }

    @Basic
    @Column(name = "logistics_code")
    public String getLogisticsCode() {
        return logisticsCode;
    }

    public void setLogisticsCode(String logisticsCode) {
        this.logisticsCode = logisticsCode;
    }

    @Basic
    @Column(name = "expire_time")
    public Date getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(Date expireTime) {
        this.expireTime = expireTime;
    }
}
